package aom.ju.ss.mode

import aom.ju.ss.mode.LpKey.TOKEN
import aom.ju.ss.mode.LpKey.USER_INFO
import aom.ju.ss.utils.SpUtils.getString
import aom.ju.ss.utils.log
import com.google.gson.Gson


class UserInfo {

    companion object {

        var userInfo: UserInfoModeData? = null
            get() {
                if (field == null) {
                    val data = getString(USER_INFO, "")
                    if (data != "") {
                        try {
                            field = Gson().fromJson(data, UserInfoModeData::class.java)
                        } catch (e: Exception) {
                            e.message?.log

                        }
                    }
                }
                return field
            }

        @get:Synchronized
        val token: String
            get() = getString(TOKEN)
    }
}